package com.cloudlead.fleetAction.action;

import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.lang.persistence.EasyuiGridData;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.annotation.Order;
import com.cloudlead.fleetAction.BusinessModules;
import com.cloudlead.fleetAction.service.FuelRegisterSer;
import com.cloudlead.fleetService.FuelRegisterService;
import com.cloudlead.fleetService.vo.FuelRegisterVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * Created by Jinnoo on 2015/8/12.
 */
@Controller
public class FuelRegisterActionFactory extends AbstractActionFactory implements FuelRegisterService {
    public FuelRegisterActionFactory() {
        super(BusinessModules.FuelRegister);
    }

    @Autowired
    FuelRegisterSer fuelRegisterSer;

    @Action
    @Order(5)
    @Label("油卡领用记录")
    @Override
    public EasyuiGridData findAllFuelRegister(FuelRegisterVo vo, int page, int rows) {
        return new EasyuiGridData(fuelRegisterSer.findAllFuelRegister(vo, page, rows),
                "id,accountNumber,backDate,comment,licence,status,money,dateGet,fleet,oilCardNumber,user," +
                        "baseDriver.id driverId," +
                        "baseOilCard.accountNumber number," +
                        "baseOilCard.id numberId," +
                        "baseDriver.name baseDriverName" );
    }
    @Action
    @Order(5)
    @Label("新增领用记录")
    @Override
    public void createFuelRegister(FuelRegisterVo vo) {
        fuelRegisterSer.createFuelRegister(vo);
    }

    @Action
    @Order(5)
    @Label("归还油卡")
    @Override
    public void editFuelRegister(FuelRegisterVo vo) {
        fuelRegisterSer.editFuelRegister(vo);
    }


    @Action
    @Order(5)
    @Label("撤销油卡领用")
    @Override
    public void removenFuelRegister(FuelRegisterVo vo) {
        fuelRegisterSer.removenFuelRegister(vo);
    }
}
